{% load sentry_helpers %}

{% url 'sentry-group' group.organization.slug group.project.slug group.id as group_link %}

{% with type=group.get_event_type metadata=group.get_event_metadata transaction=group.culprit %}
<div class="issue {% if group.is_resolved %}resolved{% endif %}">
  {% if type == "error" %}
    <div class="event-type error">
      <h3>
        {% if metadata.type %}
          <a href="{% absolute_uri group_link %}">{{ metadata.type|truncatechars:40 }}</a>
          {% if transaction %}
            <span class="event-subtitle">{{ transaction }}</span>
          {% endif %}
          <br />
          {% if metadata.value %}
            <small>{{ metadata.value|truncatechars:100|soft_break:40 }}</small>
          {% endif %}
        {% else %}
          <a href="{% absolute_uri group_link %}">{{ metadata.value|truncatechars:40 }}</a><br />
          {% if transaction %}
            <span class="event-subtitle">{{ transaction }}</span>
          {% endif %}
        {% endif %}
      </h3>
    </div>
  {% elif type == "csp" %}
    <div class="event-type csp">
      <h3>
        <a href="{% absolute_uri group_link %}">{{ metadata.directive|truncatechars:40 }}</a><br />
        {% if metadata.uri %}
          <span class="event-subtitle">{{ metadata.uri }}</span>
        {% endif %}
      </h3>
    </div>
  {% else %}
    <div class="event-type default">
      <h3>
        <a href="{% absolute_uri group_link %}">{{ group.title|truncatechars:40 }}</a><br />
        {% if transaction %}
          <span class="event-subtitle">{{ transaction }}</span>
        {% endif %}
      </h3>
    </div>
  {% endif %}
</div>
{% endwith %}
